package com.credithc.customers.manager.vo;


import lombok.Data;

import java.util.ArrayList;
import java.util.List;
@Data
//@NoArgsConstructor
public class EChartsRelationVo {
    private Title title;
    private Tooltip tooltip = new Tooltip();
    private Toolbox toolbox = new Toolbox();
    private List<Serie> series;
    @Data
    public
    class Serie{
        private String type = "force";
        private String name ;
        private Boolean ribbonType = false;
      /*  private List<Category> categories; //如果不需要颜色分类可不传*/
        private ItemStyle itemStyle = new ItemStyle();
        private Boolean useWorker = true;
        private Integer minRadius = 5;
        private Integer maxRadius = 30;//节点的最大半径最小半径
        private Double gravity =1.0;
        private Double scaling =2.2;
        private String roam = "move";
        private List<Node> nodes;
        private List<Link> links;

        @Data
        class ItemStyle{
            private Normal normal = new Normal();
            @Data
            class Normal{
                private Label label = new Label();
                private LinkStyle linkStyle = new LinkStyle();
                @Data
                class LinkStyle {
                    private String type ="curve";
                }
                @Data
                class Label{
                    private Boolean show = true;
                    private TextStyle textStyle = new TextStyle();
                    @Data
                    class TextStyle{
                        private String color ="#333";
                    }
                }
            }
        }
        @Data
        class Category{
            private String name;
        }
    }


/*//左上角标识
  private Legend legend;
    @Data
    class Legend{
        private String x = "left";
        private String[] data ;
    }*/
    @Data
    class Toolbox{
        private Boolean show = true;
        private Feature feature = new Feature();
        @Data
        class Feature{
            private Restore restore = new Restore();
            private  MagicType magicType = new MagicType();
            private SaveAsImage saveAsImage = new SaveAsImage();
            @Data
            class SaveAsImage {
                private Boolean show = true;
            }
            @Data
            class MagicType {
                private Boolean show =false;
                private String[] type ={"force","chord"};
            }
            @Data
            class Restore {
                private  Boolean show = true;
            }
        }
    }
    @Data
    class Tooltip{
        private String trigger = "item";
        private String formatter = "{a}:{b}";
    }
    @Data
    class Title{
        private String text;//标题
        private String subtext;//子标题
        private String x = "right";//标题显示位置 默认右边
        private String y = "bottom";//标题显示位置 默认底部
    }

    public EChartsRelationVo(String name, List<Node> nodes, List<Link>links){
        Serie serie = new Serie();
        serie.setName(name);
        serie.setLinks(links);
        serie.setNodes(nodes);
        this.series = new ArrayList<>();
        series.add(serie);
    }

}



